Skip to content

feat: Read config from config file or pyproject.toml#10

Merged
pawamoy merged 14 commits into
mkdocstrings:mainfrom
rafalkrupinski:feat/config
Aug 19, 2025
Merged

feat: Read config from config file or pyproject.toml#10
pawamoy merged 14 commits into
mkdocstrings:mainfrom
rafalkrupinski:feat/config

Conversation

@rafalkrupinski
Copy link
Copy Markdown
Contributor

It reads config from only three locations, config, .config nad pyproject. I felt that five locations is more suitable for mature project for compatibility, but I can change it.

Not sure about documentation tho, griffe config doesn't seem documented at all.

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

Handles #8

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 14, 2025

Tried pushing to your branch but was rejected 😕

@rafalkrupinski rafalkrupinski marked this pull request as draft July 15, 2025 09:30
@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

Tried pushing to your branch but was rejected 😕

I guess I didn't make it editable... will I open new PR or will you make a PR against my repo 😂

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 15, 2025

If you're OK to make it editable, there's a box you can check on this page to allow maintainers to edit the PR 🙂

allowedit

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

image

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 15, 2025

Huh. Maybe once it gets out of draft? Weird.

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

rafalkrupinski commented Jul 15, 2025

I just changed it to draft hoping the option would appear

@rafalkrupinski rafalkrupinski marked this pull request as ready for review July 15, 2025 14:03
@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 15, 2025

Oh OK. Can you try to open a new PR then? It will be easier than me sending a PR to your fork so that you can send it back... 😅

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

rafalkrupinski commented Jul 15, 2025

I think it's because the fork is in organisation...

edit: yep, now should work

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 15, 2025

Nice, thanks 🙂 We should now document the feature. We can probably document each item in the rendering.default_config dict. Or we could refer to https://mkdocstrings.github.io/python/usage/configuration/general/ and the other configuration sections since they work the same way 🤷

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

After your changes make check (ruff) complains about unused "noqa" directives.

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

I've added a TypedDict for the configuration to allow docstr for each entry separately. I think it's clearer than a single docstr for all entries

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

Add quotes to type expression in typing.cast()

srsly 🤣

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

TC001 Move application import griffe2md.rendering into a type-checking block

AFAIK you shouldn't mix TYPE_CHECKING and from __future__ import annotations

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

src/griffe2md/rendering.py:33: error: Cannot find implementation or library stub for module named "griffe.dataclasses" [import-not-found]
src/griffe2md/rendering.py:33: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
F

griffe.dataclasses?

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 30, 2025

Add quotes to type expression in typing.cast()

Yeah that removes the need for importing the symbols.

AFAIK you shouldn't mix TYPE_CHECKING and from future import annotations

Why? Until our lowest supported version is Python 3.14 (PEP 649), I think it's reasonable.

griffe.dataclasses?

Right this should be griffe directly.

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

Add quotes to type expression in typing.cast()

Yeah that removes the need for importing the symbols.

AFAIK you shouldn't mix TYPE_CHECKING and from __future__ import annotations

Why? Until our lowest supported version is Python 3.14 (PEP 649), I think it's reasonable.

They pretty much handle the same cases, type/lazy and potential recursive imports. Shouldn't one suffice?

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 30, 2025

Future annotations let you do this kind of things while waiting for PEP 649:

class A:
    @staticmethod
    def create_a() -> A: ...
def func() -> A:
    return A()


class A:
    pass

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

So do you want to merge, add something or you want me to figure what other entries do and update the docstrs?

@pawamoy
Copy link
Copy Markdown
Member

pawamoy commented Jul 30, 2025

If you have the capacity, documenting the other options would be great, yes, otherwise I'll get to it eventually 🙂

@rafalkrupinski
Copy link
Copy Markdown
Contributor Author

I've skipped a few fields, most of them are really self-explanatory, but I couldn't figure out load_external_modules and members

@pawamoy pawamoy merged commit c29e483 into mkdocstrings:main Aug 19, 2025
25 checks passed
@rafalkrupinski rafalkrupinski deleted the feat/config branch August 19, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants